package com.m2team.xomnhiepanh;

import android.content.Context;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.etsy.android.grid.util.DynamicHeightImageView;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import java.util.ArrayList;
import java.util.Random;

public class CustomAdapter
  extends BaseAdapter
{
  private static final String TAG = "CustomAdapter";
  private static final SparseArray<Double> sPositionHeightRatios = new SparseArray();
  private Context mContext;
  private final LayoutInflater mLayoutInflater;
  private final Random mRandom;
  ArrayList<Photo> photoList;
  
  public CustomAdapter(Context paramContext, ArrayList<Photo> paramArrayList)
  {
    this.mLayoutInflater = LayoutInflater.from(paramContext);
    this.mRandom = new Random();
    this.photoList = paramArrayList;
    this.mContext = paramContext;
  }
  
  private double getPositionRatio(int paramInt)
  {
    double d = ((Double)sPositionHeightRatios.get(paramInt, Double.valueOf(0.0D))).doubleValue();
    if (d == 0.0D)
    {
      d = getRandomHeightRatio();
      sPositionHeightRatios.append(paramInt, Double.valueOf(d));
      Log.d("CustomAdapter", "getPositionRatio:" + paramInt + " ratio:" + d);
    }
    return d;
  }
  
  private double getRandomHeightRatio()
  {
    return 1.0D;
  }
  
  public int getCount()
  {
    return this.photoList.size();
  }
  
  public Object getItem(int paramInt)
  {
    return null;
  }
  
  public long getItemId(int paramInt)
  {
    return paramInt;
  }
  
  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    ViewHolder localViewHolder;
    if (paramView == null)
    {
      paramView = this.mLayoutInflater.inflate(2130903082, paramViewGroup, false);
      localViewHolder = new ViewHolder();
      localViewHolder.imgView = ((DynamicHeightImageView)paramView.findViewById(2131099755));
      localViewHolder.titleView = ((TextView)paramView.findViewById(2131099756));
      localViewHolder.authorView = ((TextView)paramView.findViewById(2131099757));
      paramView.setTag(localViewHolder);
    }
    for (;;)
    {
      double d = getPositionRatio(paramInt);
      localViewHolder.imgView.setHeightRatio(d);
      localViewHolder.titleView.setText(((Photo)this.photoList.get(paramInt)).getTitle());
      localViewHolder.authorView.setText(((Photo)this.photoList.get(paramInt)).getAuthor());
      Picasso.with(this.mContext).load(((Photo)this.photoList.get(paramInt)).getUrl()).fit().error(2130837612).placeholder(2130837623).into(localViewHolder.imgView);
      return paramView;
      localViewHolder = (ViewHolder)paramView.getTag();
    }
  }
  
  static class ViewHolder
  {
    TextView authorView;
    DynamicHeightImageView imgView;
    TextView titleView;
  }
}



/* Location:           C:\Users\Administrator\Downloads\Convert APK to Code\dex2jar-0.0.9.15\dex2jar-0.0.9.15\classes-dex2jar.jar

 * Qualified Name:     com.m2team.xomnhiepanh.CustomAdapter

 * JD-Core Version:    0.7.0.1

 */